/******************************************************************************
 ** auth: liukai
 ** date: 2017/7
 ** ver : 1.0
 ** desc:  用户相关的接口
 ** Copyright © 2017年 尧尚信息科技(wwww.yourshares.cn). All rights reserved
 ******************************************************************************/
//  Roger:18684909663


import Moya
import YSKit
public enum UserAPI: YSTargetRequestable {
    
    case signIn(phone: String, password: String)
    
    /// 请求的URL分别写在API内部
    fileprivate struct RequestURL {
        // MARK: Market
        static let signIn = "/api/user/signIn"
    }

    public var api: YSTargetRequest {
        switch self {
        case .signIn(let email, let password):
            var parameters: [String: Any] = [:]
            parameters["email"] = email
            parameters["password"] = password
            parameters["channel"] = 0
            return YSTargetRequest(path: RequestURL.signIn,
                                   method: .post,
                                   parameters: parameters
            )
            

        }
    }

    public var path: String {
        return self.api.path
    }
    // 获取基本的url，每次发生地址变更时，替换这个url
    public var baseURL: URL {
        
        return URL(string: HostManager.kMainHost)!
    }
    public var method: Moya.Method {
        return self.api.method
    }
    public var parameters: [String: Any]? {
        return self.api.parameters
    }
    public var sampleData: Data {
        return self.api.sampleData
    }
    public var task: Task {
        return self.api.task
    }
    public var validate: Bool {
        return false
    }
    public var parameterEncoding: Moya.ParameterEncoding {
        return self.api.parameterEncoding
    }
}
